package com.example.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.backend.entity.Booklet;
import com.example.backend.entity.BookletVO;
import com.example.backend.entity.Role;
import javafx.scene.control.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 李月
 * @date 2022/5/2 9:52
 */
@Mapper
public interface BookletMapper extends BaseMapper<Booklet> {
    /**
     * @param userId 用户id
     * @param page 翻页对象
     * @return
     */
    @Select("SELECT tb_booklet.booklet_id AS bookletID,tb_booklet.booklet_name AS bookletName,tb_booklet.create_date AS createDate FROM tb_booklet,tb_user_booklet WHERE tb_user_booklet.user_id=#{userId} AND tb_booklet.booklet_id=tb_user_booklet.booklet_id")
    List<BookletVO> getBooklet(@Param("userId") int userId, Page<BookletVO> page);
}
